package org.lt.cj.view.swing;

import javax.swing.table.AbstractTableModel;

/**
 * @author zgh
 */
public class BrandListTableModel  extends AbstractTableModel {

    Object[][] p = { 
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null},
        {false, null, null, null}
    };
    //
    String[] n = {"选择", "第一列", "第二列", "第三列"};
    boolean[] canEdit = new boolean[]{true, false, false, false};
    //
    Class[] types = new Class[]{java.lang.Boolean.class, java.lang.Long.class,
        java.lang.String.class, java.lang.Integer.class
    };

    public int getColumnCount() {
        return n.length;
    }

    public int getRowCount() {
        return p.length;
    }

    @Override
    public String getColumnName(int col) {
        return n[col];
    }

    public Object getValueAt(int row, int col) {
        return p[row][col];
    }

    @Override
    public Class getColumnClass(int c) {
        return types[c];
    }

    @Override
    public boolean isCellEditable(int row, int column) {
        return canEdit[column];
    }

    @Override
    public void setValueAt(Object value, int row, int col) {
        p[row][col] = value;
        fireTableCellUpdated(row, col); //
    }

    public void setP(Object[][] p) {
        this.p = p;
    }


}
